package com.yixun.qfbao.hander;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yixun.qfbao.api.service.ThirdPartyApiService;
import com.yixun.qfbao.apidto.GetCPToM2InfoReqDto;
import com.yixun.qfbao.apidto.GetCPToM2InfoResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetCPToM2InfoReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;

/**
 * （5）	获取转客信息
 * 
 * @author jzliu
 *		
 */
@Service("getCPToM2InfoHander")
public class GetCPToM2InfoHander extends CommonAbstractHander {
	private static Logger logger= LoggerFactory.getLogger(GetCPToM2InfoHander.class);
	
	@Autowired
	private ThirdPartyApiService thirdPartyApiService;
	
	@SuppressWarnings("rawtypes")
	@Override
	public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
		GetCPToM2InfoReqVo req = (GetCPToM2InfoReqVo)reqDto;
		GetCPToM2InfoReqDto reqDto1 = req.getParams();
		BaseResponseDTO<GetCPToM2InfoResDto> res = new BaseResponseDTO<GetCPToM2InfoResDto>();
		GetCPToM2InfoResDto resDto = new GetCPToM2InfoResDto();
		try {
			resDto = thirdPartyApiService.getCPToM2Info(reqDto1);
		} catch (Exception e) {
			logger.error("GetCPToM2InfoHander error: {}", e);
			resDto.setResult(ResultEnum.FAIL.getNo());
			resDto.setResultMsg("获取转客信息!");
		}
		res.setResData(resDto);
		res.setResult(resDto.getResult());
		return res;
	}
	
}
